package com.lovo.model.DTO;

import com.lovo.model.DTO.ClassDTO;
import com.lovo.model.DTO.CourseDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class StudentDTO {
    private Integer studentId;
//    在DTO层进行数据验证
//@AssertFalse / @AssertTrue：确保值为true或false
//@Email：字符串为Email的有效值
//@Min / @Max：确保值大于等于或小于等于某个值
//@NotBlank：字符串不能为空
//@Null / @NotNull：对象不能为null
//@Pattern：正则表达式
//@Size：元素大小必须在一个边界内。对字符串、集合、映射、数组有效

    @NotBlank
    private String name;
    @NotBlank
    private String gender;

    private ClassDTO classDTO;

    private List<CourseDTO> courseDTOList = new ArrayList<>();

    public StudentDTO(Integer studentId, String name, String gender) {
        this.studentId = studentId;
        this.name = name;
        this.gender = gender;
    }
}
